/*    */ package handling.login.handler;
/*    */ 
/*    */ import client.MapleClient;
/*    */ import handling.channel.ChannelServer;
/*    */ import handling.login.LoginServer;
/*    */ import tools.MaplePacketCreator;
/*    */ import tools.data.input.LittleEndianAccessor;
/*    */ import tools.packet.LoginPacket;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class WithSecondPasswordHandler
/*    */ {
/*    */   private static boolean loginFailCount(MapleClient c) {
/* 20 */     c.loginAttempt = (short)(c.loginAttempt + 1);
/* 21 */     return (c.loginAttempt > 5);
/*    */   }
/*    */   
/*    */   public static void handlePacket(LittleEndianAccessor slea, MapleClient c, boolean view) {
/* 25 */     String password = slea.readMapleAsciiString();
/* 26 */     int charId = slea.readInt();
/* 27 */     if (view) {
/* 28 */       c.setChannel(1);
/* 29 */       c.setWorld(slea.readInt());
/*    */     } 
/* 31 */     if (!c.isLoggedIn() || loginFailCount(c) || c.getSecondPassword() == null || !c.login_Auth(charId) || ChannelServer.getInstance(c.getChannel()) == null || c.getWorld() != 0) {
/* 32 */       c.getSession().close();
/*    */       return;
/*    */     } 
/* 35 */     if (c.CheckSecondPassword(password) && password.length() >= 6 && password.length() <= 16) {
/* 36 */       if (c.getIdleTask() != null) {
/* 37 */         c.getIdleTask().cancel(true);
/*    */       }
/* 39 */       String s = c.getSessionIPAddress();
/* 40 */       LoginServer.putLoginAuth(charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP(), c.getChannel(), c.getMac());
/* 41 */       c.updateLoginState(1, s);
/* 42 */       c.announce(MaplePacketCreator.getServerIP(c, Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId));
/*    */     } else {
/* 44 */       c.announce(LoginPacket.secondPwError((byte)20));
/*    */     } 
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\handling\login\handler\WithSecondPasswordHandler.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */